#version 460 core

in vec3 FragPosition;
in vec3 FragNormal;
in vec2 FragTexCoord;

out vec4 FragColor;

uniform sampler2D tex;
uniform vec3 cameraPos;

void main() {
    vec3 normal = normalize(FragNormal);
    vec3 dir = normalize(cameraPos - FragPosition);
    float cos = abs(dot(normal, dir));
    FragColor = cos * texture(tex, FragTexCoord);
}